#include "TcpServer.hpp"
#include "Daemon.hpp"
#include <iostream>
#include <memory>
using namespace std;

Log lg;
void Usage(const std::string& cmd)
{
    cout << "\n\r" << cmd << " port[1024+]" << endl << endl; 
}

int main(int argc, char *argv[])
{
    if(argc != 2)
    {
        Usage(argv[0]);
        exit(USAGE_ERR);
    }
    lg.Enable(Classfile);
    // Daemon();
    uint16_t port = stoi(argv[1]);
    shared_ptr<TcpServer> tsv(new TcpServer(port));
    tsv->InitServer();
    tsv->Run();
    return 0;
}
